<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>Document</title>
 </head>
 <body>
  
 </body>
 <script>
    var random = Math.random()*10;//产生0到1之间的一个随机数
    console.log("random = "+random);

	//floor(X) 向下取整
	//ceil(X) 向上取整
    console.log("random_floor = "+Math.floor(random));
	console.log("random_ceil = "+Math.ceil(random));

	//产生一个随机的颜色值
	var str = "0123456789abcdef";
	var color = "#";
	var num = 0;
	while(num < 6){
	   color += str[Math.floor(Math.random()*16)];
	   num++;
	}
	console.log("color = "+color);
 </script>
</html>
